<template>
    <div class="pi" style="position: relative;overflow: hidden">
      <mt-picker :slots="_getData" valueKey="name" @change="onValuesChange" v-model="value" style="position: relative;top:-36px"></mt-picker>
    </div>
</template>

<script>
    export default {
        methods:{
          onValuesChange(picker, values) {
            if(values[0]){
              let a = {'name':values['0'].name,'id':values['0'].id}
              this.$emit('getData',a)
            }
            if (values[0] > values[1]) {
              picker.setSlotValue(1, values[0]);
            }
          }
        },
        name: "picker",
        props:{
          arrs:{
            type:Array,
          }
        },
      data() {
        return {
          value:'',
          slots: []
        };
      },
      computed:{
        toRes(){},
        _getData(){
          let slots=[
            {
              flex: 1,
              values: this.arrs,
              className: 'slot1',
              textAlign: 'right'
            }
          ]
          return slots
        }
      }
    }
</script>

<style scoped lang="stylus">

</style>
